import matplotlib.pyplot as plt
import pandas as pd
plt.rcParams['font.sans-serif'] = ['Arial Unicode MS']
plt.rcParams['axes.unicode_minus'] = False
plt.rcParams['font.size'] = 14
df = pd.read_csv('./data/ages_distribution.csv')
plt.hist(df['年龄'], bins=20, color='skyblue',
         edgecolor='darkblue')
plt.title('随机抽样1000名居民年龄分布直方图')
plt.xlabel('年龄')
plt.ylabel('人数（频数）')
plt.grid(True, axis='y', alpha=0.3)
plt.savefig('./Figures/hist09-4.png')
plt.show()
